import { createRouter, createWebHistory, RouteRecordRaw } from 'vue-router'
import HomeView from '@/views/Home/IndexView.vue'
import LayoutView from '@/views/Layout/IndexView.vue'
import CategoryView from '@/views/Category/IndexView.vue'
import LoginView from '@/views/Login/IndexView.vue'
import EchartView from '@/views/Echart/IndexView.vue'
const routes: Array<RouteRecordRaw> = [
  {
    path: '/',
    name: 'layout',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: LayoutView,
    children:[
      {
        path:'',
        component:HomeView
      },
      {
        path:'category',
        component:CategoryView
      }
    ]
  },
  {
    path: '/login',
    name: 'login',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component:LoginView
  },
  {
    path: '/echart',
    name: 'echart',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component:EchartView
  },
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
